<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./vue.js"></script>
</head>
<body>
<div id="app">
    <input type="text" name="" v-model="item">
    <button v-on:click="addTodo">添加</button>
    <hr>
    <ul>
        <li v-for="todo in todos">{{todo}}</li>
    </ul>
</div>
</body>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            massage: 'hello',
            todos: ['vue', 'django', 'flask'],
            item: ''
        },
        methods: {
            addTodo: function () {
                this.todos.push(this.item)
                alert('添加成功!')
                this.item = ''
            }
        }
    })
</script>
</html>